<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>JS盒子模型属性</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    .box {
      box-sizing: border-box;
      margin: 20px auto;
      width: 300px;
      height: 300px;
      border: 10px solid lightblue;
      background: lightcyan;
      font-size: 18px;
      line-height: 35px;
    }
  </style>
</head>
<body>
  <div id="box" class="box">
    夫君子之行, 静以修身, 俭以养德, 非淡泊无以致远夫君子之行, 静以修身, 俭以养德, 非淡泊无以致远夫君子之行, 静以修身, 俭以养德, 非淡泊无以致远夫君子之行, 静以修身, 俭以养德, 非淡泊无以致远夫君子之行, 静以修身, 俭以养德, 非淡泊无以致远
  </div>
  <script>
    let box = document.getElementById('box');
    // 获取盒子可视区域的宽高(内容宽度 + 左右padding)
    box.clientWidth;
    box.clientHeight;
  </script>
</body>
</html>